//
//  HNCourseListSeeTeacherSearchView.m
//  优学荟管理系统
//
//  Created by edz on 2017/10/31.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "HNCourseListSeeTeacherSearchView.h"

@implementation HNCourseListSeeTeacherSearchView
{
    void (^_Complete)(NSString *Str);
    __weak IBOutlet UITextField *_TextField;
}

/** 类创建 */
+ (instancetype)ConfigSeeTeacherSearchViewWithComplete:(void (^)(NSString *))Complete {
    
    return [[self alloc] initWithComplete:Complete];
}

/** 实例化 */
- (instancetype)initWithComplete:(void (^)(NSString *))Complete {
    
    self = [[NSBundle mainBundle] loadNibNamed:[HNCourseListSeeTeacherSearchView description] owner:nil options:nil][0];
    if (self) {
        _Complete = Complete;
        _TextField.delegate = self;
    }
    return self;
}


- (void)layoutSubviews {
    
    [super layoutSubviews];
    self.layer.cornerRadius = 5.0;
    self.layer.masksToBounds = YES;
}

#pragma mark - 搜索
- (BOOL)textFieldShouldReturn:(UITextField *)textField {

    [self Search:nil];
    return YES;
}


- (IBAction)Search:(UIButton *)sender {
    
    // 结束编辑
    [self endEditing:YES];

    
    _Complete ? _Complete([_TextField.text stringByReplacingOccurrencesOfString:@" " withString:@""]):nil;
}
@end
